﻿#include "TaskManager.h"
#include "Console/myobject.h"
#include "TaskReceiver.h"
#include "TaskQuality.h"
#include "TaskDataDelete.h"
#include "taskipclient.h"

TaskManager::TaskManager(QObject *parent) : QObject(parent)
{
    globalData  = GlobalData::GetInstance();
//    TaskList.append(taskReceiverJX_1);
//    TaskList.append(taskReceiverJX_2);
//    TaskList.append(taskReceiverZY_1);
//    TaskList.append(taskReceiverZY_2);
}

void TaskManager::Init() {
    MyLog::Info("TaskManager::Init");//创建文件 写入数据

    mutex.lock();

    //接收数据
    for(int i=0;i<globalData->equList.size();i++)
    {
        TaskReceiver* taskReceiver = new TaskReceiver(i);
        MyHelper::SetMoveToThread(taskReceiver);
        receiverList.append(taskReceiver);
    }

    for(int i=0;i<globalData->ipList.size();i++)
    {
        TaskIpClient * TaskIpClienter=new TaskIpClient(i);
        MyHelper::SetMoveToThread(TaskIpClienter);
    }

    //监测指标数据
//    taskQuality = new TaskQuality();
//    MyHelper::SetMoveToThread(taskQuality);

    //删除历史数据
    taskDataDelete = new TaskDataDelete();
    MyHelper::SetMoveToThread(taskDataDelete);

    mutex.unlock();
}
